/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package busquedas;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import programita.AdminDeDatos;
import programita.Alumno;

/**
 *
 * @author educacionit
 */
public class Modificar {
    public void ModificarAlumnos(){
    }
    public static void modificarAlumnoNombre(int id,String nombr){
        Connection c = null;

        try {
            String nombre= nombr.toUpperCase();
            c = AdminDeDatos.getInstance().getConnection();
            String laConsulta = "UPDATE Alumnos SET Nombre='"+nombre+"' WHERE id_Alu="+id+"";
            Statement stmtConsulta = c.createStatement();
            stmtConsulta.execute(laConsulta);
            AdminDeDatos.getInstance().releaseConnection(c);
        } catch (Exception e) {
            e.printStackTrace();

        }


   }
     public void modificarAlumnoApellido(int id,String nombr){
        Connection c = null;

        try {
            String nombre= nombr.toUpperCase();
            c = AdminDeDatos.getInstance().getConnection();
            String laConsulta = "UPDATE Alumnos SET Apellido='"+nombre+"' WHERE id_Alu="+id+"";
            Statement stmtConsulta = c.createStatement();
            stmtConsulta.execute(laConsulta);
            AdminDeDatos.getInstance().releaseConnection(c);
        } catch (Exception e) {
            e.printStackTrace();

        }


   }
          public void modificarAlumnoTutoresNombre(int id,String nombr){
        Connection c = null;

        try {
            String nombre= nombr.toUpperCase();
            c = AdminDeDatos.getInstance().getConnection();
            String laConsulta = "UPDATE Tutores SET Nombre='"+nombre+"' WHERE id_Alu="+id+"";
            Statement stmtConsulta = c.createStatement();
            stmtConsulta.execute(laConsulta);
            AdminDeDatos.getInstance().releaseConnection(c);
        } catch (Exception e) {
            e.printStackTrace();

        }


   }
     public void modificarAlumnoTutoresApellido(int id,String nombr){
        Connection c = null;

        try {
            String nombre= nombr.toUpperCase();
            c = AdminDeDatos.getInstance().getConnection();
            String laConsulta = "UPDATE Tutores SET Apellido='"+nombre+"' WHERE id_Alu="+id+"";
            Statement stmtConsulta = c.createStatement();
            stmtConsulta.execute(laConsulta);
            AdminDeDatos.getInstance().releaseConnection(c);
        } catch (Exception e) {
            e.printStackTrace();

        }


   }

     
     public void ModCursoPrimJard(int Grado,String Division,int id) {
//  ACORDARSE DE QUE EN CVASO DE QUE SEA SALA REC ES 0 la division
	    Connection c = null;

	    ArrayList<Alumno> coleccionAlumnos= new ArrayList<Alumno>();

	    try {

	        c = AdminDeDatos.getInstance().getConnection();
               
	        String laConsulta =  "UPDATE Alumnos SET Grado="+Grado+" AND Div ='"+Division+"' WHERE id_Alu="+id+"";
                Statement stmtConsulta = c.createStatement();
                stmtConsulta.execute(laConsulta);

                AdminDeDatos.getInstance().releaseConnection(c);
	    } catch (Exception e) {
	        e.printStackTrace();

            }
	

   }
          public void ModCursoIngles(int Grado,String Division,int id) {
//  ACORDARSE DE QUE EN CVASO DE QUE SEA SALA REC ES 0 la division
	    Connection c = null;

	    ArrayList<Alumno> coleccionAlumnos= new ArrayList<Alumno>();

	    try {

	        c = AdminDeDatos.getInstance().getConnection();
               
	        String laConsulta =  "UPDATE Alumnos SET Grado="+Grado+" AND Turno ='"+Division+"' WHERE id_Alu="+id+"";
                Statement stmtConsulta = c.createStatement();
                stmtConsulta.execute(laConsulta);

                AdminDeDatos.getInstance().releaseConnection(c);
	    } catch (Exception e) {
	        e.printStackTrace();

            }
            
            
	

   }

}



